package com.mybatis.mapper;

import com.mybatis.domain.StaffInfo;
import com.mybatis.domain.StaffInfoPage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-03-24 08:49:56
 */
//@CacheNamespace(implementation = MForRedisCache.class, eviction = MForRedisCache.class)
public interface StaffInfoMapper {

    List<StaffInfo> findAll(StaffInfoPage page);

    List<StaffInfo> findAll(String name);

    @Select({"select * from staff_info where id=#{id}"})
    StaffInfo findById(@Param("id") Long id);

    //    @Insert({"insert into staff_info(id,name) values (#{id},#{name})"})
//    @SelectKey(statement = "select last_insert_id()", keyColumn = "id", keyProperty = "id", before = false, resultType = Long.class)
    int insertOne(StaffInfo staffInfo);

    @Delete({"delete from staff_info where id=#{id}"})
    int deleteOneById(@Param("id") Long id);

    List<StaffInfo> findInfoById(@Param("id") Long id);
}
